﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace com.lover.astd.game.ui
{
    public partial class AttackTargetSelector : Form
    {
        private string _cityname;
        public AttackTargetSelector()
        {
            InitializeComponent();
        }

        private void lnk_clicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            LinkLabel lbl = sender as LinkLabel;
            _cityname = lbl.Text;
            this.Close();
        }
        public string getCityname() { return _cityname; }
        public void setCityInfo(Dictionary<int, int> cityinfo, int selfCityId) 
        {
            foreach(int cityid in cityinfo.Keys)
            {
                string lb_name = "lb_" + cityid;
                Control[] controls = this.Controls.Find(lb_name, true);
                if (Controls != null && controls.Length > 0)
                {
                    LinkLabel lb = controls[0] as LinkLabel;
                    if (lb == null) continue;
                    if (cityid == selfCityId) lb.BackColor = System.Drawing.Color.Plum;
                    else lb.BackColor = System.Drawing.SystemColors.Control;
                    if (cityinfo[cityid] == 0) lb.LinkColor = System.Drawing.Color.Gray;
                    else if (cityinfo[cityid] == 1) lb.LinkColor = System.Drawing.Color.Black;
                    else if (cityinfo[cityid] == 2) lb.LinkColor = System.Drawing.Color.Red;
                    else if (cityinfo[cityid] == 3) lb.LinkColor = System.Drawing.Color.Blue;
                }
            }
            
        }
    }
}
